#!/bin/bash

# @(#) –Builds Firefox extensions
BASELOC=$PWD
EXTENSION=$1

mkdir -p ./build/chrome
cd ./chrome
rm -f .DS_Store
zip -r $EXTENSION.jar ./

mv $EXTENSION.jar .././build/chrome
cd $BASELOC

cp ./install.* ./build
find . -name ‘update.*’ | xargs -I % cp % ./build
cp ./*.manifest ./build

if [ -d "./defaults/preferences" ]; then
mkdir -p ./build/defaults/preferences
cd ./defaults/preferences
cp ./*.* ../../build/defaults/preferences
fi
cd “$BASELOC/build”

rm -f .DS_Store

zip -r $EXTENSION.xpi ./*
mv $EXTENSION.xpi ../
cd ../
rm -r src/build
